const sequelize = require('./db')

const Accounts = require('./Accounts')
require('./Events')
require('./RoadCondition')

sequelize.sync({ alter: true }).then(async () => {
  console.log('数据库同步成功')
  // 插入测试数据，区分用户类型
  await Accounts.create({
    name: 'normal_user',
    password: 'password123',
    juri: 0,
    user_type: 'normal',
  })
  await Accounts.create({
    name: 'traffic_user',
    password: 'traffic123',
    juri: 0,
    user_type: 'traffic',
  })
  await Accounts.create({
    name: 'admin_user',
    password: 'admin123',
    juri: 0,
    user_type: 'admin',
  })
  console.log('测试账户已插入')
})
